package cn.doitedu.crawler;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;

/***
 * @author hunter.d
 * @qq 657270652
 * @wx haitao-duan
 * @date 2020/8/27
 **/
public class AnZhi {
    public static void main(String[] args) throws IOException {
        Connection conn = Jsoup.connect("http://www.anzhi.com/sort_45_1_hot.html");
        Document doc = conn.get();

        Elements lis = doc.getElementsByClass("app_list border_three").get(0).getElementsByTag("ul").get(0).getElementsByTag("li");
        for (Element li : lis) {
            Element atag = li.getElementsByAttribute("title").get(0);
            String title = atag.attr("title");
            String href = atag.attr("href");
            System.out.println(title + " --> " + href);
        }

    }
}
